//
//  MeCell.swift
//  DiZhenYuJing
//
//  Created by zhibao on 2024/2/12.
//

import UIKit
class MeCell: UITableViewCell{
    let nameLabel = UILabel()
    let detailLabel = UILabel()
    let imgView = UIImageView()
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        nameLabel.font = MY_SCALE_FONT(14)
        nameLabel.textColor = MYColor.color(withHexString: "666666")
        self.contentView.addSubview(nameLabel)
        nameLabel.snp.makeConstraints { make in
            make.left.equalTo(pixw(p: 60))
            make.top.bottom.equalTo(self.contentView)
            make.height.equalTo(pixw(p: 54))
        }
        self.contentView.addSubview(imgView)
        imgView.tintColor = MYBlue
        imgView.snp.makeConstraints { make in
            make.left.equalTo(pixw(p: 30))
            make.centerY.equalTo(nameLabel)
        }
        
        let rightImgView = UIImageView(image: UIImage(named: "comm_right"))
        self.contentView.addSubview(rightImgView)
        rightImgView.snp.makeConstraints { make in
            make.right.equalTo(self.contentView).offset(pixw(p: -30))
            make.centerY.equalTo(nameLabel)
        }
        
        detailLabel.font = MY_SCALE_LightFONT(12)
        detailLabel.textColor = MYColor.color(withHexString: "999999")
        self.contentView.addSubview(detailLabel)
        detailLabel.snp.makeConstraints { make in
            make.right.equalTo(rightImgView.snp.left).offset(pixw(p: -10))
            make.centerY.equalTo(nameLabel)
            make.height.equalTo(pixw(p: 54))
        }
    }
    
    func updata(dic:[String:String]) {
        detailLabel.text = ""
        imgView.image = UIImage(systemName: dic["img"] ?? "")
        nameLabel.text = dic["name"]
        detailLabel.text = dic["detail"]
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
